package thirt.view
{
	import flash.display.Bitmap;
	import flash.display.DisplayObjectContainer;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.filters.GlowFilter;
	import flash.text.TextField;
	
	public class ConsolePoint extends Sprite
	{
		private var bitmap:Bitmap;
		private var txt:TextField;
		public function ConsolePoint(parent:DisplayObjectContainer=null,
			xpos:Number=0,ypos:Number=0,hander:Function=null,fun2:Function=null,cls:Class=null)
		{
			this.x = xpos;
			this.y = ypos;
			
			bitmap = new cls;
			bitmap.x = -bitmap.width/2;
			bitmap.y = -bitmap.height/2;
			this.addChild(bitmap);
			
			if(parent != null)
			{
				parent.addChild(this);
			}
			this.addEventListener(MouseEvent.MOUSE_DOWN,hander);
			this.addEventListener(MouseEvent.MOUSE_MOVE,fun2);
			this.addEventListener(MouseEvent.MOUSE_OUT,onMouseout);
			this.addEventListener(MouseEvent.MOUSE_DOWN,onDownBitmap);
		}
		public function setXY(xpos:Number,ypos:Number):void{
			this.x = xpos;
			this.y = ypos;
		}
		private function onDownBitmap(event:MouseEvent):void{
			bitmap.filters = [new GlowFilter(0x7BB2CC,1,10,10,3)];
		}
		private function onMouseout(event:MouseEvent):void{
			/* if(Console(this.parent.parent).change)
				Coursor.getInstance().removeCoursor(); */
			bitmap.filters = null
		}
		public function addText():void{
			txt = new TextField;
			txt.width = 200;
			txt.height = 30;
			txt.x = 10;
			txt.y = -30;
			txt.htmlText = "<font color='#ffffff'>已经超出打印区域</font>";
			txt.filters = [new GlowFilter(0xff0000,1,3,3)]
			txt.mouseEnabled = false;
			
		}
		public function showAlert():void{
			this.addChild(txt);
		}
		public function hideAlert():void{
			if(txt.parent){
				txt.parent.removeChild(txt);
			}
		}
	}
}